package com.vcredit.creditcat.service.report.impl;

import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;

import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import com.vcredit.creditcat.api.ICatCardManager;
import com.vcredit.creditcat.dto.catCard.CatCardInfoDto;
import com.vcredit.creditcat.dto.creditrepository.ItemReportStatusDto;
import com.vcredit.creditcat.dto.creditrepository.ItemStatusDto;
import com.vcredit.creditcat.dto.zmxy.ZmxyQueryDto;
import com.vcredit.creditcat.enumtype.report.AuthReportItemEnum;
import com.vcredit.creditcat.manager.report.CreditAussureTaskResultManager;
import com.vcredit.creditcat.manager.report.MobileBillSummaryManager;
import com.vcredit.creditcat.manager.zmxy.ZmxyProcessManager;
import com.vcredit.creditcat.model.AuthIdentity;
import com.vcredit.creditcat.model.AuthItem;
import com.vcredit.creditcat.model.AuthMobile;
import com.vcredit.creditcat.model.AuthProccess;
import com.vcredit.creditcat.model.AuthSecredit;
import com.vcredit.creditcat.model.CreditAssureVo;
import com.vcredit.creditcat.model.CreditService;
import com.vcredit.creditcat.model.CreditServiceVo;
import com.vcredit.creditcat.model.CreditSuggestVo;
import com.vcredit.creditcat.model.CreditTipsShowVo;
import com.vcredit.creditcat.model.Cust;
import com.vcredit.creditcat.model.CustQualificationStatistics;
import com.vcredit.creditcat.model.CustReportParam;
import com.vcredit.creditcat.model.CustReportVo;
import com.vcredit.creditcat.model.MobileReportVo;
import com.vcredit.creditcat.model.QueryServiceVo;
import com.vcredit.creditcat.model.SesameScoreVo;
import com.vcredit.creditcat.model.TextConstant;
import com.vcredit.creditcat.model.VipInfoVo;
import com.vcredit.creditcat.service.AuthIdentityService;
import com.vcredit.creditcat.service.AuthItemService;
import com.vcredit.creditcat.service.AuthMobileService;
import com.vcredit.creditcat.service.AuthProccessService;
import com.vcredit.creditcat.service.AuthSecreditService;
import com.vcredit.creditcat.service.CreditServiceService;
import com.vcredit.creditcat.service.CustCreditRepositoryService;
import com.vcredit.creditcat.service.CustQualificationStatisticsService;
import com.vcredit.creditcat.service.auth.AuthItemExtService;
import com.vcredit.creditcat.service.catfood.CatfoodService;
import com.vcredit.creditcat.service.report.CustReportService;
import com.vcredit.creditcat.util.ConcurrentDateUtil;
import com.vcredit.creditcat.util.Utility;
import com.vcredit.creditcat.vo.custReoprt.CreditDescriptionVo;
import com.vcredit.creditcat.vo.custReoprt.CreditEducation;
import com.vcredit.framework.annotation.Log;

/**
 * 
 * @author chengxin
 *
 */
@Service
public class CustReportServiceImpl implements CustReportService {

	@Autowired
	private CustQualificationStatisticsService custQualificationStatisticsService;
	@Autowired
	private AuthSecreditService authSecreditService;
	@Value("${project.serviceUrl}")
	private String reportUrl;

	private static final String timestatus = "0001-01-01 00:00:00";
	private static final String higher = "higher";
	private static final String middle = "middle";
	private static final String lower = "lower";
	private static final String STR1 = "<font color=\"#FFFFFF\">预估贷款额度</font><font color=\"#FF0000\">10000</font><font color=\"#FFFFFF\">元，成功率</font><font color=\"#FF0000\">98%</font>。";
	private static final String STR2 = "<font color=\"#FFFFFF\">预估贷款额度</font><font color=\"#FF0000\">8000</font><font color=\"#FFFFFF\">元，成功率</font><font color=\"#FF0000\">75%</font>。";
	private static final String STR3 = "<font color=\"#FFFFFF\">预估贷款额度</font><font color=\"#FF0000\">5000</font><font color=\"#FFFFFF\">元，成功率</font><font color=\"#FF0000\">50%</font>。";
	private static final String STR4 = "<font color=\"#FFFFFF\">预估贷款额度</font><font color=\"#FF0000\">2500</font><font color=\"#FFFFFF\">元，成功率</font><font color=\"#FF0000\">25%</font>。";

	private static final String creditReportUrl = "app://centralbankcredit";

	private static final String STR5 = "<font color=\"#FFFFFF\">当前报告完成度";
	private static final String STR6 = "%......</font>";
	private static final String imgv = "transferImages/image_lv0.png";
	private static final int higherScore = 10;
	private static final int middleScore = 5;
	private static final int lowerScore = 1;

	private static StringBuffer subHigh = new StringBuffer();// 信用现状高级文案
	private static StringBuffer subMiddle = new StringBuffer();// 信用现状中级文案
	private static StringBuffer subLower = new StringBuffer();// 信用现状低级文案
	private static StringBuffer sugg = new StringBuffer();// 改善建议
	private static int allScore = 0;
	private static int booleanCount = 0;

	@Autowired
	private CreditAussureTaskResultManager creditAussureTaskResultManager;
	@Autowired
	private MobileBillSummaryManager mobileBillSummaryManager;
	@Autowired
	private AuthProccessService authProccessService;
	@Autowired
	private AuthIdentityService authIdentityService;
	@Autowired
	private AuthMobileService authMobileService;
	@Autowired
	private AuthItemService authItemService;
	@Autowired
	private AuthItemExtService authItemExtService;
	@Autowired
	private CustCreditRepositoryService creditRepositoryService;
	@Autowired
	private CreditServiceService creditService;
	@Autowired
	private CatfoodService catfoodService;
	@Autowired
	private ICatCardManager catCardManager;
	@Autowired
	private ZmxyProcessManager zmxyProcessManager;
	private static Logger logger = LoggerFactory.getLogger(CustReportServiceImpl.class);

	/**
	 * 报表分析 1.根据报表 来需求
	 */
	@Log
	@Override
	public CustReportVo custReoprtAnalysis(Long custId, CustReportParam custReportParam) throws Exception {

		// TODO ------代码 优化 默认查认证项 ，如果认证项都做过则去直接去拉取
		CustReportVo custReportVo = new CustReportVo();
		custReportVo.setCreditStatus(0);
		custReportVo.setMobileStatus(0);
		CustReportVo vo = new CustReportVo();
		vo = statusReturn(vo, custId);
		// 手机自动拉取
		if (2 == vo.getAuthMobileStatus()) {
			List<AuthProccess> processese = authProccessService.findByCustId(custId);
			AuthMobile mobileobj = new AuthMobile();
			mobileobj.setProcessId(processese.get(0).getProccessId());
			// mobileobj.setResultStatus(4);
			List<AuthMobile> mobileList = authMobileService.findDistinctMobile(mobileobj);
			if (mobileList.size() > 0) {
				for (AuthMobile authMobile : mobileList) {
					if (4 == authMobile.getResultStatus()) {
						mobileBillSummaryManager.saveMobileBillSummary(custId);
					} else if (2 == authMobile.getResultStatus()) {
						custReportVo.setMobileStatus(1);
					}
				}
			}
		}
		if (1 == custReportParam.getCreditAssure()) {
			creditAussureTaskResultManager.saveCustAnalysis(custId);
		}
		if (1 == custReportParam.getMobile()) {
			mobileBillSummaryManager.saveMobileBillSummary(custId);
		}
		CustQualificationStatistics custQ = new CustQualificationStatistics();
		custQ.setCustId(custId);
		List<CustQualificationStatistics> custQualist = custQualificationStatisticsService.find(custQ);

		CreditAssureVo creditAssureVo = new CreditAssureVo();

		MobileReportVo mobileReportVo = new MobileReportVo();
		subHigh = new StringBuffer();// 信用现状高级文案
		subMiddle = new StringBuffer();// 信用现状中级文案
		subLower = new StringBuffer();// 信用现状低级文案
		sugg = new StringBuffer();// 改善建议

		if (custQualist.size() > 0) {
			CustQualificationStatistics custQua = custQualist.get(0);
			/** ----------------------征信 **/
			SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
			String asureTime = df.format(custQua.getCreditExpiredTime());

			if (!timestatus.equals(asureTime)) {
				creditAssureVo = this.creditAssure(creditAssureVo, custQua);
				if (null != creditAssureVo.getCreditHistory()) {
					int creditAssureScore = assureScore(creditAssureVo);
					custReportVo.setCreditStatus(1);
					creditAssureScore = (int) Math.ceil(Utility.divDouble(creditAssureScore, 5, 0));
					creditAssureVo.setCreditAssureScore(creditAssureScore + "");
					creditAssureVo(creditAssureVo);

				}
			}
			/** -----手机----------------- */
			String mobileTime = df.format(custQua.getMobileExpiredTime());

			if (!timestatus.equals(mobileTime)) {
				mobileReportVo = this.mobile(mobileReportVo, custQua);
				if (null != mobileReportVo.getHabitsCustoms()) {

					custReportVo.setMobileStatus(1);
					int mobileScore = mobileScore(mobileReportVo);
					mobileScore = (int) Math.ceil(Utility.divDouble(mobileScore, 5, 0));
					mobileReportVo.setMobilescore(mobileScore + "");
					mobileReportVo(mobileReportVo);
				}
			}

			// 计算手机分数 修改手机分数
			if (null == creditAssureVo.getCreditHistory()) {
				statusReturn(custReportVo, custId);
				custReportVo.setCreditAssure(null);
			} else {
				custReportVo.setCreditAssure(creditAssureVo);
			}
			if (null == mobileReportVo.getConsumptionLeve()) {
				statusReturn(custReportVo, custId);
				custReportVo.setMobile(null);
			} else {
				custReportVo.setMobile(mobileReportVo);

			}
			// 封装返回数据
			custReportVoReturn(custReportVo, creditAssureVo, mobileReportVo);
		} else {
			statusReturn(custReportVo, custId);
		}

		return custReportVo;
	}

	public CustReportVo statusReturn(CustReportVo custReportVo, Long custId) {
		// 第几步骤
		List<AuthProccess> processese = authProccessService.findByCustId(custId);
		if (processese.size() > 0) {
			AuthIdentity authIdentity = authIdentityService.findByProcessId(processese.get(0).getProccessId());
			if (null != authIdentity &&2==authIdentity.getStatus() ) {
				custReportVo.setAuthMobileStatus(2);
				custReportVo.setAuthCreditStatus(2);
			} else {
				custReportVo.setAuthMobileStatus(1);
				custReportVo.setAuthCreditStatus(1);
			}
		} else {
			custReportVo.setAuthMobileStatus(1);
			custReportVo.setAuthCreditStatus(1);
		}

		return custReportVo;

	}

	public CustReportVo custReportVoReturn(CustReportVo custReportVo, CreditAssureVo creditAssureVo, MobileReportVo mobileReportVo) {
		// 计算平均分
		List<CreditSuggestVo> xianzhuangList = new ArrayList<CreditSuggestVo>();
		CreditSuggestVo xianzhuangvo = new CreditSuggestVo();
		List<CreditSuggestVo> suggList = new ArrayList<CreditSuggestVo>();
		CreditSuggestVo creditSuggestVo = new CreditSuggestVo();
		SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");

		if (StringUtils.isNotBlank(subLower.toString())) {
			String ars[] = subLower.toString().split(";");
			for (int i = 0; i < ars.length; i++) {
				String describe = ars[i];
				xianzhuangvo.setSuggId(i + 1);
				xianzhuangvo.setDescription(describe);
				xianzhuangList.add(xianzhuangvo);
			}
			String suggest[] = sugg.toString().split(";");
			for (int i = 0; i < suggest.length; i++) {
				String describe = suggest[i];
				creditSuggestVo.setSuggId(i + 1);
				creditSuggestVo.setDescription(describe);
				suggList.add(creditSuggestVo);
			}

		} else if (StringUtils.isNotBlank(subMiddle.toString())) {
			// 信用现状
			xianzhuangvo.setSuggId(1);
			xianzhuangvo.setDescription(CreditDescriptionVo.middleWenan);
			xianzhuangList.add(xianzhuangvo);

			creditSuggestVo.setSuggId(1);
			creditSuggestVo.setDescription(CreditDescriptionVo.nosuggest);
			suggList.add(creditSuggestVo);

		} else {
			// 信用现状
			xianzhuangvo.setSuggId(1);
			xianzhuangvo.setDescription(CreditDescriptionVo.hightWenan);
			xianzhuangList.add(xianzhuangvo);

			creditSuggestVo.setSuggId(1);
			creditSuggestVo.setDescription(CreditDescriptionVo.nosuggest);
			suggList.add(creditSuggestVo);

		}
		custReportVo.setProposal(suggList);
		custReportVo.setSituation(xianzhuangList);
		return custReportVo;

	}

	/**
	 * 判断是否大于另一个数
	 * 
	 * @param b1
	 * @param v2
	 * @return
	 */
	public boolean sub(BigDecimal b1, double v2) {
		/*
		 * BigDecimal b1 = new BigDecimal(Double.toString(v1));
		 */
		BigDecimal b2 = new BigDecimal(Double.toString(v2));

		if (b1.subtract(b2).doubleValue() >= 0) {
			return true;
		} else {
			return false;
		}
	}

	public double except(Integer a, Integer b, int floats) {
		if (b == 0) {
			return 0;
		} else {
			double f1 = new BigDecimal((float) a / b).setScale(floats, BigDecimal.ROUND_HALF_UP).doubleValue();
			return f1;
		}

	}

	public CreditAssureVo creditAssure(CreditAssureVo creditAssureVo, CustQualificationStatistics custQua) {
		// 信用历史creditHistory;
		if (custQua.getLoanDelayCnt() < 1 && custQua.getCrdMthLmTwoYearsRctMMin() < 3 && custQua.getCrdMthLmTwoYearsRctMMin() < 12) {
			creditAssureVo.setCreditHistory(higher);
			subHigh.append(CreditDescriptionVo.creditHistory + ";");
		} else if (custQua.getLoanDelayCnt() > 1 && custQua.getCrdMthLmTwoYearsRctMMin() > 5 && custQua.getCrdMthLmTwoYearsRctMMin() < 3) {
			creditAssureVo.setCreditHistory(lower);
			subLower.append(CreditDescriptionVo.creditHistory + ";");
			sugg.append(CreditDescriptionVo.creditHistorysugg + ";");
		} else {
			subMiddle.append(CreditDescriptionVo.creditHistory + ";");
			creditAssureVo.setCreditHistory(middle);
		}
		// 客户属性clientProperty;
		String education = custQua.getEducation();
		boolean edu = education.contains("本科") || education.contains("研究生");
		boolean loweredu = education.equals(CreditEducation.illiteracy) || education.equals(CreditEducation.primary) || education.equals(CreditEducation.middle) || education.equals(CreditEducation.technical)
				|| education.equals(CreditEducation.secondary) || education.equals(CreditEducation.high);
		if (0 == custQua.getSex() && custQua.getMarriage().contains("未婚") && edu) {
			creditAssureVo.setClientProperty(higher);
			subHigh.append(CreditDescriptionVo.clientProperty + ";");
		} else if (1 == custQua.getSex() && custQua.getMarriage().contains("已婚") && edu) {
			subHigh.append(CreditDescriptionVo.clientProperty + ";");
			creditAssureVo.setClientProperty(higher);
		} else if (0 == custQua.getSex() && loweredu && custQua.getMarriage().equals("已婚")) {
			creditAssureVo.setClientProperty(lower);
			subLower.append(CreditDescriptionVo.clientProperty + ";");
			sugg.append(CreditDescriptionVo.clientPropertysugg + ";");

		} else if (1 == custQua.getSex() && loweredu && custQua.getMarriage().equals("未婚")) {
			creditAssureVo.setClientProperty(lower);
			subLower.append(CreditDescriptionVo.clientProperty + ";");
			sugg.append(CreditDescriptionVo.clientPropertysugg + ";");
		} else {
			subMiddle.append(CreditDescriptionVo.clientProperty + ";");
			creditAssureVo.setClientProperty(middle);
		}
		// 偿还能力 repaymentAbility;
		if (custQua.getCreditNormalPayMax() >= 20 && custQua.getLmTwoYearsLnPaycntMax() >= 20 && custQua.getLmTwoYearsCrdColPaycntMax() >= 20) {
			creditAssureVo.setRepaymentAbility(higher);
			subHigh.append(CreditDescriptionVo.repaymentAbility + ";");

		} else if (custQua.getCreditNormalPayMax() < 12 && custQua.getLmTwoYearsLnPaycntMax() > 0 && custQua.getLmTwoYearsLnPaycntMax() < 20 && custQua.getLmTwoYearsCrdColPaycntMax() < 6) {
			creditAssureVo.setRepaymentAbility(lower);
			subLower.append(CreditDescriptionVo.repaymentAbility + ";");
			sugg.append(CreditDescriptionVo.repaymentAbilitysugg + ";");
		} else {
			creditAssureVo.setRepaymentAbility(middle);
			subMiddle.append(CreditDescriptionVo.repaymentAbility + ";");

		}
		// 消费习惯 consumptionHabit;
		double quotaUtilization = Utility.div(custQua.getNormUsedSum(), custQua.getNormCdtSum(), 4);

		if (quotaUtilization >= 0.002 && quotaUtilization < 0.7 && Utility.sub(custQua.getNormCdtBalAvg(), 6500) < 0 && custQua.getLstPayDebtActNum() >= 6) {
			creditAssureVo.setConsumptionHabit(higher);
			subHigh.append(CreditDescriptionVo.consumptionHabit + ";");

		} else if (Utility.sub(custQua.getNormCdtBalAvg(), 10000) >= 0 && custQua.getLstPayDebtActNum() >= 6 || quotaUtilization < 0.002 || quotaUtilization > 0.9) {
			creditAssureVo.setConsumptionHabit(lower);
			subLower.append(CreditDescriptionVo.consumptionHabit + ";");
			sugg.append(CreditDescriptionVo.consumptionHabitsugg + ";");

		} else {
			creditAssureVo.setConsumptionHabit(middle);
			subMiddle.append(CreditDescriptionVo.consumptionHabit + ";");
		}
		// 负债情况 liabilities;

		if (this.sub(custQua.getLmTwoYearsLoanUsedrate(), 0) && this.sub(custQua.getLmTwelvemonthLoanUsedrate(), 0.7) && custQua.getNormCdtBalUsedPctAvg().intValue() < 20) {
			creditAssureVo.setLiabilities(higher);
			subHigh.append(CreditDescriptionVo.liabilities + ";");

		} else if (this.sub(custQua.getLmTwoYearsLoanUsedrate(), 0.9) && this.sub(custQua.getLmTwelvemonthLoanUsedrate(), 0.95) && custQua.getNormCdtBalUsedPctAvg().intValue() >= 100) {
			subLower.append(CreditDescriptionVo.liabilities + ";");
			sugg.append(CreditDescriptionVo.liabilitiessugg + ";");

			creditAssureVo.setLiabilities(lower);
		} else {
			creditAssureVo.setLiabilities(middle);
			subMiddle.append(CreditDescriptionVo.liabilities + ";");

		}
		return creditAssureVo;
	}

	public MobileReportVo mobile(MobileReportVo mobileReportVo, CustQualificationStatistics custQua) {
		// ----------消费水平
		if (this.sub(custQua.getScrCellMaxPlanAmt(), 100) && Utility.div(custQua.getTrcLsmOneAvgPlanAmt(), custQua.getTrcLsmOneAvgTotalAmt(), 3) >= 0.97
				&& Utility.sub(custQua.getScrHundredEightyDaysCellCallingSubttl(), 30) < 0) {
			mobileReportVo.setConsumptionLeve(higher);
			subHigh.append(CreditDescriptionVo.consumptionLeve + ";");

		} else if (Utility.sub(custQua.getScrCellMaxPlanAmt(), 50) < 0 && Utility.div(custQua.getTrcLsmOneAvgPlanAmt(), custQua.getTrcLsmOneAvgTotalAmt(), 3) < 0.826
				&& this.sub(custQua.getScrHundredEightyDaysCellCallingSubttl(), 150)) {
			mobileReportVo.setConsumptionLeve(lower);
			subLower.append(CreditDescriptionVo.consumptionLeve + ";");
			sugg.append(CreditDescriptionVo.consumptionLevesugg + ";");

		} else {
			mobileReportVo.setConsumptionLeve(middle);
			subMiddle.append(CreditDescriptionVo.consumptionLeve + ";");

		}
		// 近30天通话联系人占比
		double contacts = this.except(custQua.getLdThirtyDaysTotalPplCnt(), custQua.getLdHundredFiftyDaysTotalPplCnt(), 3);
		// 日均被叫联系人个数
		double dalyCall = this.except(custQua.getScrCellCalledPhoneCnt(), custQua.getScrCellCalledCttDaysCnt(), 3);
		// 人脉关系
		if (contacts < 0.4 && dalyCall < 0.7 && custQua.getSmsHundredFiftyDaysLdTtlPpl() < 20) {
			mobileReportVo.setPersonalRelationship(higher);
			subHigh.append(CreditDescriptionVo.personalRelationship + ";");

		} else if (contacts > 0.5 && dalyCall > 1 && custQua.getSmsHundredFiftyDaysLdTtlPpl() > 35) {
			mobileReportVo.setPersonalRelationship(lower);
			subLower.append(CreditDescriptionVo.personalRelationship + ";");
			sugg.append(CreditDescriptionVo.personalRelationshipsugg + ";");

		} else {
			mobileReportVo.setPersonalRelationship(middle);
			subMiddle.append(CreditDescriptionVo.personalRelationship + ";");

		}

		// ----------生活习惯
		// 累计深夜通话时长比
		double nightCallLength = this.except(custQua.getScrCellEvnCallTtlTime(), custQua.getScrCellCallTtlTime(), 3);
		// 近150天早上通话次数比
		double callRatio = this.except(custQua.getLdHundredFiftyDaysSmyCttMrgCnt(), custQua.getLdHundredFiftyDaysCttCnt(), 3);
		// 累计下午通话时长比
		double talkTimeRatio = this.except(custQua.getScrCellAftnCallTtlTime(), custQua.getScrCellCallingTtlTime(), 3);

		if (nightCallLength < 0.02 && callRatio > 0.3 && talkTimeRatio > 0 && talkTimeRatio < 0.28) {
			mobileReportVo.setHabitsCustoms(higher);
			subHigh.append(CreditDescriptionVo.habitsCustoms + ";");

		} else if (nightCallLength > 0.04 && callRatio < 0.2 && talkTimeRatio > 0 && talkTimeRatio < 0.28) {
			mobileReportVo.setHabitsCustoms(lower);
			subLower.append(CreditDescriptionVo.habitsCustoms + ";");
			sugg.append(CreditDescriptionVo.habitsCustomssugg + ";");

		} else {
			mobileReportVo.setHabitsCustoms(middle);
			subMiddle.append(CreditDescriptionVo.habitsCustoms + ";");

		}

		// ------------------ 工作性质
		// 近90天工作日通话联系人占比
		double nightyCallRatio = this.except(custQua.getLdNinetyWeekCttPpl(), custQua.getLdNinetyTotalPplCnt(), 3);
		// 近90天累计主被叫联系人比
		double called = this.except(custQua.getLdNinetyTcallPplCnt(), custQua.getLdNinetyTansTotalPpl(), 3);

		double hundreEighty = this.except(custQua.getCallHundredEightyDaysCallTime(), custQua.getCallHundredEightyDaysLstmCallCnt(), 3);
		double denominator = this.except(custQua.getCallHundredEightyDaysCalledTime(), custQua.getCallHundredEightyDaysCalledCnt(), 3);
		// 近180天平均主被叫时长比
		double avghundreEighty = Utility.divDouble(hundreEighty, denominator, 3);

		if (nightyCallRatio >= 0.79 && nightyCallRatio < 0.85 && called < 0.6 && avghundreEighty >= 1.2) {
			mobileReportVo.setWorkNature(higher);
			subHigh.append(CreditDescriptionVo.workNature + ";");

		} else if (nightyCallRatio >= 0.9 && called >= 1 && avghundreEighty < 1) {
			mobileReportVo.setWorkNature(lower);
			subLower.append(CreditDescriptionVo.workNature + ";");
			sugg.append(CreditDescriptionVo.workNaturesugg + ";");

		} else {
			mobileReportVo.setWorkNature(middle);
			subMiddle.append(CreditDescriptionVo.workNature + ";");

		}

		// ---------- 稳定程度
		// 近30天晚间被叫次数占比
		double thirtyCalled = this.except(custQua.getLdThirtyDaysSmyAnsEvngCnt(), custQua.getLdHundredFiftyDaysSmyAnsEvngCnt(), 3);

		if (custQua.getScrCellPhUseMons() >= 60 && custQua.getLdHundredFiftyDaysCttDay() >= 148 && thirtyCalled > 0.17 && thirtyCalled < 0.27) {
			mobileReportVo.setStabilityDegree(higher);
			subHigh.append(CreditDescriptionVo.stabilityDegree + ";");

		} else if (custQua.getScrCellPhUseMons() < 24 && custQua.getLdHundredFiftyDaysCttDay() < 1408 && thirtyCalled >= 0.3) {
			mobileReportVo.setStabilityDegree(lower);
			subLower.append(CreditDescriptionVo.stabilityDegree + ";");
			sugg.append(CreditDescriptionVo.stabilityDegreesugg + ";");

		} else {
			mobileReportVo.setStabilityDegree(middle);
			subMiddle.append(CreditDescriptionVo.stabilityDegree + ";");

		}
		return mobileReportVo;
	}

	/**
	 * 信用贴士
	 */
	@Log
	@Override
	public CreditTipsShowVo CustGradeAnalysis(Cust cust, String appDesc) throws Exception {
		Long custId = null;
		if (null != cust) {
			custId = cust.getCustId();
		}
		// TODO Auto-generated method stub
		CreditTipsShowVo creditTipsShowVo = new CreditTipsShowVo();
		logger.info("is flag=========" + custId);
		// 喵卡
		vipInfo(creditTipsShowVo, cust);
		// 顶部展示
		banner(creditTipsShowVo, custId);
		// 查询服务
		queryServiceVo(creditTipsShowVo, cust, appDesc, creditTipsShowVo.getIsFlag());
		// 信用服务
		creditServiceVo(creditTipsShowVo, custId);

		return creditTipsShowVo;
	}

	/**
	 * 封装头部信息
	 * 
	 * @param creditTipsShowVo
	 * @param custId
	 * @return
	 * @throws Exception
	 */
	public CreditTipsShowVo banner(CreditTipsShowVo creditTipsShowVo, Long custId) throws Exception {
		allScore = 0;
		booleanCount = 0;
		if (null == custId) {
			creditTipsShowVo.setIsFlag(0);
		} else {
			CreditAssureVo creditAssureVo = new CreditAssureVo();
			MobileReportVo mobileReportVo = new MobileReportVo();

			CustQualificationStatistics custQ = new CustQualificationStatistics();
			custQ.setCustId(custId);
			List<CustQualificationStatistics> custQualist = custQualificationStatisticsService.find(custQ);
			creditTipsShowVo.setIsFlag(0);
			if (custQualist.size() > 0) {
				CustQualificationStatistics custQua = custQualist.get(0);
				/** ----------------------征信 **/
				SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
				/** -----手机----------------- */
				String mobileTime = df.format(custQua.getMobileExpiredTime());
				if (!timestatus.equals(mobileTime)) {
					mobileReportVo = this.mobile(mobileReportVo, custQua);
					if (null != mobileReportVo) {
						++booleanCount;
						allScore += mobileScore(mobileReportVo);
					}
				}
				creditTipsShowVo.setIsFlag(1);
				// 封装返回数据
				creditTipsShowVo(creditTipsShowVo, creditAssureVo, mobileReportVo, custQua);
			}
		}
		logger.info("分数" + creditTipsShowVo.toString());
		return creditTipsShowVo;

	}

	/**
	 * 返回vip信息（该值为null时，卡片上不显示vip栏信息）
	 * 
	 * @param creditTipsShowVo
	 * @param custId
	 * @return
	 */
	public CreditTipsShowVo vipInfo(CreditTipsShowVo creditTipsShowVo, Cust cust) {
		Long inscore = 0L;
		if (null != cust) {
			inscore = catfoodService.queryCustRemainCatfood(cust);
		}
		creditTipsShowVo.setIntegral(inscore.intValue());
		VipInfoVo vipInfoVo = null;
		if (null != cust) {
			CatCardInfoDto dot = catCardManager.getCatCardInfo(cust);
			vipInfoVo = new VipInfoVo();
			vipInfoVo.setVipIcon(dot.getVipIcon());// vip图标
			vipInfoVo.setVipDesc(dot.getVipDesc());// vip描述
			vipInfoVo.setVipLink(dot.getVipLink());// vip链接
			vipInfoVo.setCardNo(dot.getCardNo());// 喵卡卡号
			vipInfoVo.setRealName(dot.getRealName());// 用户姓名
			vipInfoVo.setCardType(dot.getCardType());// 喵卡等级（1:标准卡 2:银卡 3:金卡
														// 4:白金卡//
														// 5:钻石卡6：黑卡），用于卡片背景图片显示
			if (0 == dot.getCardType()) {
				vipInfoVo.setCardName(TextConstant.MIAOKA);// 喵卡名称
			} else {
				vipInfoVo.setCardName(dot.getCardName());// 喵卡名称
			}

		} else {
			vipInfoVo = new VipInfoVo();
			vipInfoVo.setCardType(0);
			vipInfoVo.setVipIcon(reportUrl + imgv);
			vipInfoVo.setVipDesc(TextConstant.OPEN_VZERO_TXT);
			vipInfoVo.setVipLink("");
			vipInfoVo.setCardNo("");// 喵卡卡号
			vipInfoVo.setRealName("");// 用户姓名
			vipInfoVo.setCardType(0);// 喵卡等级（1:标准卡2:银卡3:金卡4:白金卡5:钻石卡6：黑卡），用于卡片背景图片显示
			vipInfoVo.setCardName(TextConstant.MIAOKA);// 喵卡名称
		}
		creditTipsShowVo.setCardInfo(vipInfoVo);
		return creditTipsShowVo;

	}

	/**
	 * 查询服务
	 * 
	 * @param creditTipsShowVo
	 * @param custId
	 * @return
	 * @throws Exception
	 */
	public CreditTipsShowVo queryServiceVo(CreditTipsShowVo creditTipsShowVo, Cust cust, String appDesc, int isFlag) throws Exception {
		AuthItem itemObj = new AuthItem();
		List<AuthItem> itemsList = authItemService.find(itemObj);
		QueryServiceVo queryServiceVo = new QueryServiceVo();
		List<QueryServiceVo> queryServiceVoList = new ArrayList<QueryServiceVo>();
		// 获取认证项状态
		int wanchengdu = 0;
		int reportLength = AuthReportItemEnum.values().length;

		if (null == cust) {
			for (AuthReportItemEnum c : AuthReportItemEnum.values()) {
				for (AuthItem authItem : itemsList) {
					if (c.getCode().equals(authItem.getAuthCode())) {
						queryServiceVo = new QueryServiceVo();
						queryServiceVo.setItemName(authItem.getItemName());// string项目名称
						queryServiceVo.setItemIcon(reportUrl+c.getUrl());// string项目图标
						queryServiceVo.setItemDesc(authItem.getItemDesc());// string项目描述
						queryServiceVo.setItemStatus(0);// int 报告获取状态（0:未获取
														// 1:获取中2:已获取）
						queryServiceVo.setAvailable(1);// int 项目使用状态（0:不可用 1:可用）
						queryServiceVo.setItemUrl(reportUrl + c.getUrl());// string
																			// 报告链接
						queryServiceVoList.add(queryServiceVo);
					}
				}
			}
		} else {
			// 判断是否做过高级实名 做过就继续 ，否则其他认证项都没做过
			List<ItemStatusDto> itemStatusDtos = authItemExtService.getItemStatusDtoByCustAndProduct(cust, 0L);
			boolean flag = false;
			// TODO 是否重置了认证项
			for (ItemStatusDto itemStatusDto : itemStatusDtos) {
				if (65536 == itemStatusDto.getItemCode()) {
					/* 认证状态:0:未认证，1:已完成，2:认证中，3:认证失败 */
					if ("1".equals(itemStatusDto.getStatus())) {
						flag = true;
						break;
					}
				}
			}
			// 返回的 报告项目
			for (AuthReportItemEnum c : AuthReportItemEnum.values()) {
				for (AuthItem authItem : itemsList) {
					if (c.getCode().equals(authItem.getAuthCode())) {
						// 判断做没做高级实名
						queryServiceVo = new QueryServiceVo();
						if (flag) {
							// 获取认证状态 及过期时间
							ItemReportStatusDto itemStatusDto = creditRepositoryService.getAuthStatus(authItem.getAuthCode() + "", 2, cust);

							// 获取认证状态
							int itemStatus = Integer.parseInt(itemStatusDto.getStatus());
							// 1可用
							queryServiceVo.setItemUrl(reportUrl + c.getUrl());// string
																				// 报告链接
							// 判断手机做没做===手机特殊 是爬取
							if ("16".equals(c.getCode())) {
								if (1 == isFlag) {
									wanchengdu++;
									// queryServiceVo.setItemUrl(reportUrl +
									// mobileReportUrl);// string
									queryServiceVo.setItemStatus(2);// 报告获取状态（0:未获取1:获取中2:已获取）
								} else {
									queryServiceVo.setItemStatus(0);// 报告获取状态（0:未获取1:获取中2:已获取）
								}
							} else {
								if (1 == itemStatus || 4 == itemStatus) {
									wanchengdu++;
									// 如果征信做过
									if (64 == authItem.getAuthCode()) {
										queryServiceVo.setItemUrl(creditReportUrl);// string
									}
									queryServiceVo.setItemStatus(2);// 报告获取状态（0:未获取1:获取中2:已获取）
								} else if (0 == itemStatus) {
									queryServiceVo.setItemStatus(0);// 报告获取状态（0:未获取1:获取中2:已获取）
								} else {
									if (64 == authItem.getAuthCode()) {
										queryServiceVo.setItemUrl(creditReportUrl);// string
									}
									queryServiceVo.setItemStatus(1);// 报告获取状态（0:未获取1:获取中2:已获取）
								}
							}
							queryServiceVo.setItemName(c.getDesc());// string项目名称
							queryServiceVo.setItemIcon(reportUrl+c.getImg());// string项目图标
							queryServiceVo.setItemDesc(authItem.getItemDesc());// string项目描述
							queryServiceVo.setAvailable(c.getAvailable());// 项目使用状态（0:不可用
							queryServiceVoList.add(queryServiceVo);
						} else {
							queryServiceVo.setItemName(c.getDesc());// string
																				// 项目名称
							queryServiceVo.setItemIcon(reportUrl+c.getImg());// string
																				// 项目图标
							queryServiceVo.setItemDesc(authItem.getItemDesc());// string
																				// 项目描述
							queryServiceVo.setItemStatus(0);// int 报告获取状态（0:未获取
															// 1:获取中 2:已获取）
							queryServiceVo.setAvailable(1);// int 项目使用状态（0:不可用
															// 1:可用）
							queryServiceVo.setItemUrl(reportUrl + c.getUrl());// string
																				// 报告链接
							queryServiceVoList.add(queryServiceVo);
							continue;
						}
					}
				}
			}
			double wangchengdus = Utility.divDouble(wanchengdu, reportLength, 2);
			creditTipsShowVo.setCompletion(STR5 + wangchengdus * 100 + STR6);
			/*
			 * if (StringUtils.isNotBlank(creditTipsShowVo.getImproveAdvise()))
			 * { // 拼装完成度 creditTipsShowVo.setImproveAdvise(creditTipsShowVo.
			 * getImproveAdvise()); } else {
			 * creditTipsShowVo.setImproveAdvise("<br/>" + STR5 + wangchengdus *
			 * 100 + "%"); }
			 */

		}
		creditTipsShowVo.setQueryService(queryServiceVoList);
		return creditTipsShowVo;
	}

	/**
	 * 信用服务
	 * 
	 * @param creditTipsShowVo
	 * @param custId
	 * @return
	 */
	public CreditTipsShowVo creditServiceVo(CreditTipsShowVo creditTipsShowVo, Long custId) {
		CreditService obj = new CreditService();
		obj.setAvailable(1);
		List<CreditService> list = creditService.find(obj);
		List<CreditServiceVo> voList = new ArrayList<CreditServiceVo>();

		CreditServiceVo vo = new CreditServiceVo();
		for (CreditService creditService : list) {
			vo = new CreditServiceVo();
			vo.setAvailable(creditService.getAvailable());
			vo.setItemDesc(creditService.getItemdesc());
			vo.setItemIcon(creditService.getItemicon());
			vo.setItemName(creditService.getItemname());
			vo.setItemUrl(creditService.getReporturl());
			voList.add(vo);
		}
		creditTipsShowVo.setCreditService(voList);
		return creditTipsShowVo;
	}

	public CreditTipsShowVo creditTipsShowVo(CreditTipsShowVo creditTipsShowVo, CreditAssureVo creditAssureVo, MobileReportVo mobileReportVo, CustQualificationStatistics custQua) throws ParseException {
		// 计算平均分
		double avgScore = 0;
		if (2 == booleanCount) {
			avgScore = Utility.divDouble(allScore, 10, 2);
		} else if (1 == booleanCount) {
			avgScore = Utility.divDouble(allScore, 5, 2);
		}

		// CreditSuggestVo creditSuggestVo = new CreditSuggestVo();

		BigDecimal bd = new BigDecimal(avgScore).setScale(0, BigDecimal.ROUND_HALF_UP);
		creditTipsShowVo.setScore(Integer.parseInt(bd.toString()));// 信用分值
		creditTipsShowVo.setEvaluateDesc(describe(avgScore));// 信用评价
		SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");

		String formatDate = df.format(custQua.getUpdatedTime());
		if (9 <= avgScore && avgScore <= 10) {
			creditTipsShowVo.setImproveAdvise(CreditDescriptionVo.COLORHEAD+CreditDescriptionVo.dengji + CreditDescriptionVo.descGood+CreditDescriptionVo.COLORWEI);
			creditTipsShowVo.setQuota(STR1);
		} else if (8 <= avgScore && avgScore < 9) {
			creditTipsShowVo.setImproveAdvise(CreditDescriptionVo.COLORHEAD+CreditDescriptionVo.dengji + CreditDescriptionVo.descBetter+CreditDescriptionVo.COLORWEI);
			creditTipsShowVo.setQuota(STR2);
		} else if (5 <= avgScore && avgScore < 8) {
			creditTipsShowVo.setImproveAdvise(CreditDescriptionVo.COLORHEAD+CreditDescriptionVo.dengji + CreditDescriptionVo.descSimple+CreditDescriptionVo.COLORWEI);
			creditTipsShowVo.setQuota(STR3);
		} else {
			creditTipsShowVo.setImproveAdvise(CreditDescriptionVo.COLORHEAD+CreditDescriptionVo.dengji + CreditDescriptionVo.descImprove+CreditDescriptionVo.COLORWEI);
			creditTipsShowVo.setQuota(STR4);
		}
		// 过期时间 拼装文案
		if (ConcurrentDateUtil.getNowDate().after(custQua.getMobileExpiredTime())) {
			creditTipsShowVo.setDiagStatus("0");// 诊断结果状态（0:无效 1:有效）
		} else {
			creditTipsShowVo.setDiagStatus("1");
			// 诊断结果状态（0:无效 1:有效）
		}
		creditTipsShowVo.setEvaluateTime(formatDate);// 评估时间
		return creditTipsShowVo;

	}

	/**
	 * 返回文案
	 */
	public CreditSuggestVo assureWenan(CreditAssureVo creditAssureVo, CreditSuggestVo creditSuggestVo) {
		int score = 0;
		score = switchScore(creditAssureVo.getCreditHistory());// 信用历史\\
		if (lowerScore == score) {
			subLower.append(CreditDescriptionVo.creditHistory);
		}
		switchScore(creditAssureVo.getClientProperty());// 客户属性
		switchScore(creditAssureVo.getRepaymentAbility()); // 偿还能力
		switchScore(creditAssureVo.getConsumptionHabit()); // 消费习惯
		switchScore(creditAssureVo.getLiabilities()); // 负债情况
		return creditSuggestVo;
	}

	public int mobileWenan(MobileReportVo mobileReportVo, CreditSuggestVo creditSuggestVo) {
		int score = 0;

		score += switchScore(mobileReportVo.getConsumptionLeve());// 消费水平
		score += switchScore(mobileReportVo.getPersonalRelationship());// 人脉关系
		score += switchScore(mobileReportVo.getHabitsCustoms());// 生活习惯
		score += switchScore(mobileReportVo.getWorkNature());// 工作性质
		score += switchScore(mobileReportVo.getStabilityDegree());// 稳定程度
		return score;
	}

	/**
	 * 返回信用评价
	 * 
	 * @param score
	 * @return
	 */
	public String describe(double score) {
		if (9 <= score) {
			return CreditDescriptionVo.descGood;
		} else if (score >= 8 && score < 9) {
			return CreditDescriptionVo.descBetter;

		} else if (score >= 5 && score < 8) {
			return CreditDescriptionVo.descSimple;
		} else {
			return CreditDescriptionVo.descImprove;
		}
	}

	public int assureScore(CreditAssureVo creditAssureVo) {
		int score = 0;
		score += switchScore(creditAssureVo.getCreditHistory());// 信用历史
		score += switchScore(creditAssureVo.getClientProperty());// 客户属性
		score += switchScore(creditAssureVo.getRepaymentAbility()); // 偿还能力
		score += switchScore(creditAssureVo.getConsumptionHabit()); // 消费习惯
		score += switchScore(creditAssureVo.getLiabilities()); // 负债情况
		return score;
	}

	/**
	 * 封装返回 实体
	 * 
	 * @param creditAssureVo
	 * @return
	 */
	public CreditAssureVo creditAssureVo(CreditAssureVo creditAssureVo) {
		creditAssureVo.setCreditHistory(switchScore(creditAssureVo.getCreditHistory()) + "");// 信用历史
		creditAssureVo.setClientProperty(switchScore(creditAssureVo.getClientProperty()) + "");// 客户属性
		creditAssureVo.setRepaymentAbility(switchScore(creditAssureVo.getRepaymentAbility()) + ""); // 偿还能力
		creditAssureVo.setConsumptionHabit(switchScore(creditAssureVo.getConsumptionHabit()) + ""); // 消费习惯
		creditAssureVo.setLiabilities(switchScore(creditAssureVo.getLiabilities()) + ""); // 负债情况
		return creditAssureVo;
	}

	public MobileReportVo mobileReportVo(MobileReportVo mobileReportVo) {

		mobileReportVo.setConsumptionLeve(switchScore(mobileReportVo.getConsumptionLeve()) + "");// 消费水平
		mobileReportVo.setPersonalRelationship(switchScore(mobileReportVo.getPersonalRelationship()) + "");// 人脉关系
		mobileReportVo.setHabitsCustoms(switchScore(mobileReportVo.getHabitsCustoms()) + "");// 生活习惯
		mobileReportVo.setWorkNature(switchScore(mobileReportVo.getWorkNature()) + "");// 工作性质
		mobileReportVo.setStabilityDegree(switchScore(mobileReportVo.getStabilityDegree()) + "");// 稳定程度
		return mobileReportVo;
	}

	public int mobileScore(MobileReportVo mobileReportVo) {
		int score = 0;

		score += switchScore(mobileReportVo.getConsumptionLeve());// 消费水平
		score += switchScore(mobileReportVo.getPersonalRelationship());// 人脉关系
		score += switchScore(mobileReportVo.getHabitsCustoms());// 生活习惯
		score += switchScore(mobileReportVo.getWorkNature());// 工作性质
		score += switchScore(mobileReportVo.getStabilityDegree());// 稳定程度
		return score;
	}

	public int switchScore(String keys) {
		int socre = 0;
		switch (keys) {
		case higher:
			socre = higherScore;
			break;
		case middle:
			socre = middleScore;
			break;
		case lower:
			socre = lowerScore;
			break;
		}
		return socre;

	}

	/**
	 * 获取芝麻分
	 */
	
	public SesameScoreVo getSesameScoreVos(Cust cust, String ispull) throws Exception {
		// TODO Auto-generated method stub
		// 1、查询数据库是否有值 2.没有判断是否认证过了 没有认证过 返回状态
		// 高级实名
		SesameScoreVo sesameScoreVo = new SesameScoreVo();

		if (StringUtils.isNotBlank(ispull)) {
			@SuppressWarnings("unused")
			ZmxyQueryDto zp = zmxyProcessManager.zmxyQuery(cust);
		}
		Long custId = cust.getCustId();
		List<AuthProccess> processese = authProccessService.findByCustId(custId);
		sesameScoreVo.setExpirateOrNo(0);// 是否过期0，未过期 1，已过期
		sesameScoreVo.setSesameScore(0);
		sesameScoreVo.setExpirate("");// 过期日期
		sesameScoreVo.setIsFlag(0);// 是否 做过 0未做过 1.做过芝麻分
		sesameScoreVo.setAssessmentTime("");

		// 芝麻分
		AuthSecredit authSecredit = new AuthSecredit();
		authSecredit.setAuthStatus(4);
		authSecredit.setProcessId(processese.get(0).getProccessId());
		List<AuthSecredit> auth = authSecreditService.find(authSecredit);
		if (auth.size() > 0) {
			authSecredit = auth.get(0);
			if (StringUtils.isNotBlank(authSecredit.getExpiredTime()) && -1 != authSecredit.getResultStatus()) {
				SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");

				String formatDate = df.format(df.parse(authSecredit.getExpiredTime()));
				String assessmentTime = "";
				if (StringUtils.isNotBlank(authSecredit.getAuthTime())) {
					assessmentTime = df.format(df.parse(authSecredit.getAuthTime()));
				}
				sesameScoreVo.setSesameScore(Integer.parseInt(authSecredit.getZmxyScore()));
				sesameScoreVo.setExpirate(formatDate);// 过期日期
				sesameScoreVo.setAssessmentTime(assessmentTime);
				sesameScoreVo.setIsFlag(1);// 是否 做过 0未做过 1.做过芝麻分
				if (ConcurrentDateUtil.getNowDate().after(ConcurrentDateUtil.getDateTime(authSecredit.getExpiredTime()))) {
					sesameScoreVo.setExpirateOrNo(1);// 是否过期0，未过期 1，已过期
				} else {
					sesameScoreVo.setExpirateOrNo(0);// 是否过期0，未过期 1，已过期
				}
			} else {
				sesameScoreVo.setAuthStatus(2);
			}
		} else {
			sesameScoreVo.setAuthStatus(2);
		}

		return sesameScoreVo;
	}

	/**
	 * 获取芝麻分
	 */
	@Override
	public SesameScoreVo getSesameScoreVo(Cust cust, String ispull) throws Exception {
		Long custId = cust.getCustId();
		if (StringUtils.isNotBlank(ispull)) {
			@SuppressWarnings("unused")
			ZmxyQueryDto zp = zmxyProcessManager.zmxyQuery(cust);
		}
		// TODO Auto-generated method stub
		// 1、查询数据库是否有值 2.没有判断是否认证过了 没有认证过 返回状态
		// 高级实名
		SesameScoreVo sesameScoreVo = new SesameScoreVo();
		List<AuthProccess> processese = authProccessService.findByCustId(custId);
		sesameScoreVo.setExpirateOrNo(0);// 是否过期0，未过期 1，已过期
		sesameScoreVo.setSesameScore(0);
		sesameScoreVo.setExpirate("");// 过期日期
		sesameScoreVo.setIsFlag(0);// 是否 做过 0未做过 1.做过芝麻分
		sesameScoreVo.setAssessmentTime("");
		if (processese.size() > 0) {
			AuthIdentity authIdentity = authIdentityService.findByProcessId(processese.get(0).getProccessId());
			if (null != authIdentity ) {

				// 芝麻分
				AuthSecredit authSecredit = new AuthSecredit();
				authSecredit.setAuthStatus(4);
				authSecredit.setProcessId(processese.get(0).getProccessId());
				List<AuthSecredit> auth = authSecreditService.find(authSecredit);
				if (auth.size() > 0) {
					authSecredit = auth.get(0);
					if (StringUtils.isNotBlank(authSecredit.getExpiredTime()) && -1 != authSecredit.getResultStatus()) {
						SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");

						String formatDate = df.format(df.parse(authSecredit.getExpiredTime()));
						String assessmentTime = "";
						if (StringUtils.isNotBlank(authSecredit.getAuthTime())) {
							assessmentTime = df.format(df.parse(authSecredit.getAuthTime()));
						}
						sesameScoreVo.setSesameScore(Integer.parseInt(authSecredit.getZmxyScore()));
						sesameScoreVo.setExpirate(formatDate);// 过期日期
						sesameScoreVo.setAssessmentTime(assessmentTime);
						sesameScoreVo.setIsFlag(1);// 是否 做过 0未做过 1.做过芝麻分
						if (ConcurrentDateUtil.getNowDate().after(ConcurrentDateUtil.getDateTime(authSecredit.getExpiredTime()))) {
							sesameScoreVo.setExpirateOrNo(1);// 是否过期0，未过期 1，已过期
						} else {
							sesameScoreVo.setExpirateOrNo(0);// 是否过期0，未过期 1，已过期
						}
					} else {
						sesameScoreVo.setAuthStatus(2);
					}

				} else {
					sesameScoreVo.setAuthStatus(2);
				}

			} else {
				sesameScoreVo.setAuthStatus(1);
			}
		} else {
			sesameScoreVo.setAuthStatus(1);
		}

		return sesameScoreVo;
	}
}
